package com.yanqu.road.entity.enums;

import java.util.HashMap;

public enum eOrderProductType {
	Coin("coin", "元宝"),
	Package("package", "礼包"),
	Subscription("subscription", "订阅"),
	;

	private String value;
	private String name;

	eOrderProductType(String value, String name) {
		this.value = value;
		this.name = name;
		eOrderProductType.getMappings().put(value, this);
	}

	public String getValue() {
		return value;
	}

	private static HashMap<String, eOrderProductType> mappings;

	private synchronized static HashMap<String, eOrderProductType> getMappings() {
		if (mappings == null) {
			mappings = new HashMap<>();
		}
		return mappings;
	}

	public static eOrderProductType forValue(String value) {
		return getMappings().get(value);
	}
}
